<template>
    <div>
      <template v-if="userInfo.type !== 1">
      <a-card title="账号信息" style="margin-bottom:24px">
        <detail-list :col="3">
            <detail-list-item term="帐号名称">{{detail.accountName}}</detail-list-item>
            <detail-list-item term="联系人">{{detail.contact}}</detail-list-item>
            <detail-list-item term="联系人电话">{{detail.contactPhone}}</detail-list-item>
            <detail-list-item term="使用状态">{{detail.status === 1 ? '启用':'禁用'}}</detail-list-item>
            <detail-list-item term="邮箱">{{detail.email}}</detail-list-item>
        </detail-list>
      </a-card>

      <a-card title="企业信息" style="margin-bottom:24px">
        <detail-list :col="3">
            <detail-list-item term="法人姓名">{{detail.legalPersonName}}</detail-list-item>
            <detail-list-item term="法人身份证号码">{{detail.legalPersonIdCard}}</detail-list-item>
            <template v-if="userInfo.type===2">
              <detail-list-item term="企业名称">{{detail.name}}</detail-list-item>
            </template>
            <template v-else-if="userInfo.type===3">
              <detail-list-item term="园区名称">{{detail.name}}</detail-list-item>
            </template>
            <template v-else-if="userInfo.type===1">
              <detail-list-item term="公司名称">{{detail.name}}</detail-list-item>
            </template>
            <detail-list-item term="纳税人性质">{{detail.taxNature === 1 ? '一般':'小规模'}}</detail-list-item>
            <detail-list-item term="银行帐号">{{detail.bankCard}}</detail-list-item>
            <detail-list-item term="法人手机号">{{detail.legalPersonPhone}}</detail-list-item>
            <detail-list-item term="预留手机号">{{detail.bankReservedPhone}}</detail-list-item>
            <detail-list-item term="统一信用代码">{{detail.creditCode}}</detail-list-item>
            <detail-list-item term="动态口令手机号码">{{detail.dynamicWordPhone}}</detail-list-item>
            <detail-list-item term="企业地址">{{detail.address}}</detail-list-item>
        </detail-list>
       
        <detail-list :col="4" style="margin-top: 20px;">
          <detail-list-item term="资质" v-if="userInfo.type === 3">
            <viewer :images = "[detail.certificate]">
              <img :src="detail.certificate" alt="无图片" style="width: 150px;" />
            </viewer>
          </detail-list-item>
          <detail-list-item term="营业执照">
            <viewer :images = "[detail.businessLicense]">
              <img :src="detail.businessLicense" alt="无图片" style="width: 150px;" />
            </viewer>
          </detail-list-item>
          <detail-list-item term="法人身份证正面">
            <viewer :images = "[detail.legalPersonIdCardFront]">
              <img :src="detail.legalPersonIdCardFront" alt="无图片" style="width: 150px;" />
            </viewer>
          </detail-list-item>
          <detail-list-item term="法人身份证反面">
            <viewer :images = "[detail.legalPersonIdCardBackend]">
              <img :src="detail.legalPersonIdCardBackend" alt="无图片" style="width: 150px;" />
            </viewer>
          </detail-list-item>
        </detail-list>
      </a-card>
       </template>

       <div v-if="userInfo.type === 1" class="warpper-box">
        <a-empty />
       </div>
      

    </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { 
  SysGetEnterpriseIdInfo
} from '@/api/manage/enterprise'
import { 
  sysGetParkIdInfo
} from '@/api/manage/park'
import DetailList from '@/components/tools/DetailList'
const DetailListItem = DetailList.Item
export default {
  name: 'basiceInfo',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      detail:{
        accountName: "",
        address: "",
        area: "",
        areaCode: "",
        bankCard: "",
        bankReservedPhone: "",
        businessLicense: "",
        contact: " ",
        contactPhone: "",
        createdBy: "",
        createdByName: "",
        createdTime: "",
        creditCode: "",
        dynamicWordPhone: "",
        email: "",
        enterprises: '',
        id: '',
        certificate:'',
        legalPersonIdCard: "",
        legalPersonIdCardBackend: "",
        legalPersonIdCardFront: "",
        legalPersonName: " ",
        legalPersonPhone: "",
        name: "",
        status: '',
        taxNature: '',
        userTypeCode: ""
      }
    }
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  mounted () {
    this.loadData();
  },
  methods: {
    async loadData(){
      if(this.userInfo.type === 3){
        const {code,data} = await sysGetParkIdInfo(this.userInfo.relationId);
        if(code ==='1'){
          for(var key in data){
            this.detail[key] = data[key];
          }
        }
      }else if(this.userInfo.type === 2){
        const {code,data} = await SysGetEnterpriseIdInfo(this.userInfo.relationId);
        if(code ==='1'){
          for(var key in data){
            this.detail[key] = data[key];
          }
        }
      }else{

      }
      
    },
    
  }
}
</script>
